package com.wn.pettyloan.security.emp;

import com.wn.pettyloan.entity.Emp;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutHandler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @program: pettyloan
 * @ClassName EmpLogoutHandler
 * @description:
 * @author: 韩旭
 * @create: 2022-12-16 09:39
 **/
@Slf4j
public class EmpLogoutHandler implements LogoutHandler {
    @Override
    public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
        Emp emp = (Emp) authentication.getPrincipal();
        String username = emp.getEmpUacc();
        log.info("username: {}  is offline now", username);
    }

}